<?php
declare (strict_types=1);

namespace app\admin\middleware;

use app\common\model\Logs as LogsModel;

class Logs
{
    public function handle($request, \Closure $next)
    {
        $response = $next($request);
        if ($request->logs && cache('system')['is_log']) {
            LogsModel::add(session('admin_id'), 1, $request->logs);
        }

        return $response;
    }
}